

checkUserType()

if(!checkLogin()){
	$("#loginStatue").css("display", "none")
}

// $.ajax({
// 	url: path + "user/checkIsLogin",
// 	type: "POST",
// 	data: {},
// 	dataType: "json",
// 	crossDomain: true,
// 	xhrFields: {
// 		withCredentials: true
// 	},
// 	async: false,
// }).done(function(data) {
	
// 	if(data.success != undefined){
// 		// console.log(data.success)	
// 		// console.log($("#loginStatue"))
// 		$("#loginStatue").css("display", "none")
// 	}
// })




$.ajax({
	url: path + "companyPosition/selectCompanyPosition",
	type: "POST",
	data: {},
	dataType: "json",
	crossDomain: true,
	xhrFields: {
		withCredentials: true
	},
	async: false,
}).done(function(data) {
	if (data.success) {
		
			d = data.positionList
			c = data.companyList
			ff = data.founderList
			// console.log(c)
			firx = '<li class="clearfix">'
			sufix = '</li>'
			var str = firx
			i = 0
			max = 7
			countNum = 0
			min = 0
			if(d.length > c.length){
				min = c.length
			}else{
				min = d.length
			}
			if(min > max){
				countNum = max
			}else{
				countNum = min
			}
			// console.log(min)
			// console.log(countNum)
			for(i;i<countNum;i++){
				
					v=d[i]
					// console.log(i)
					str += firx
					str += '<div class="hot_pos_l"><div class="mb10"><a href="jobdetail.html?id='+v.id+'" target="_blank">'+v.positionType+v.positionName+'</a>&nbsp;<span class="c9">['+v.positionAddress+']</span></div><span><em class="c7">月薪： </em>'+v.salaryMin+"K-"+v.salaryMax+"K"+'</span><span><em class="c7">经验：</em>'+v.workYear+'</span><span><em class="c7">最低学历： </em>'+v.education+'</span><br /><span><em class="c7">职位诱惑：</em>'+v.positionAdvantage+'</span><br /><span>'+v.createDate.substring(0,10)+'</span></div>'
				
					cc = c[i]
					// console.log(i)
					if(cc.name != undefined){
					//console.log(c)
						str += '<div class="hot_pos_r"><div class="mb10 recompany"><a href=viewCompany.html?id='+cc.userId+' target="_blank">'+cc.name+'</a></div><span><em class="c7">领域：</em>'+cc.domain+'</span><span><em class="c7">创始人：</em>'+ff[i].founderName+'</span><br /><span><em class="c7">阶段：</em>'+cc.development+'</span><span><em class="c7">规模：</em>'+cc.scale+'</span><ul class="companyTags reset">'
					}
					//alert(cc.tag.split(",").length)
					if((cc.tag).length > 0){
						//console.log(cc.tag.split(",").length)
						temp = cc.tag.split(",")
						for(var k = 0; k< temp.length; k++){
							//console.log(temp[k])
							str += '<li>'+ temp[k] +'</li>'
						}
						
						str += '</ul></div>'
					}
					str +=sufix
			}
			
			str += '<a href="list.html" class="btn fr" target="_blank">查看更多</a>'
			// console.log(str)
  $("#positionList").html(str)

	}
})


//查询内容的判断
 $("a").each(function () {
	 if($(this).attr("href")){
		 href = $(this).attr('href')
		 if(href.startsWith('h/jobs/list_')){
		 		 $(this).attr('href','list.html?positionName='+$(this).text())
		 }
	 }
 })
 
 $("#searchType").hover(function() {
 	$(this).children("li").show(), $(this).siblings(".searchtype_arrow").addClass("transform")
 }, function() {
 	$(this).children("li").not(".type_selected").hide(), $(this).siblings(".searchtype_arrow").removeClass(
 		"transform")
 }), $("#searchType li").click(function() {
 	$(this).siblings("li").hide(), $(this).hasClass("type_selected") || ($("#searchType li").removeClass(
 		"type_selected"), $(this).addClass("type_selected").prependTo("#searchType"));
 	var b = $(this).attr("data-searchtype");
 	1 == b ? ($("#search_input").attr("placeholder", "请输入职位名称，如：产品经理"), $(".placeholder").val("请输入职位名称，如：产品经理")) : ($(
 		"#search_input").attr("placeholder", "请输入公司名称，如：牛币"), $(".placeholder").val("请输入公司名称，如：牛币")), $("#spcInput").val(
 		b), $(this).children("li").not(".type_selected").hide(), $(this).siblings(".searchtype_arrow").removeClass("transform")
	if(b == 1){
		$("#selectType").val('职位')
	}else{
		$("#selectType").val('公司')
	}
	
 })